<%@ page import="studentinformationmanagementsystem.entity.Student" %>
<c:out value="expression" default="expression" escapeXml="false"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%Student studentlogin = (Student)request.getSession().getAttribute("Studentlogin");%>
	学生信息管理平台
</title><link href="../style/StudentStyle.css" rel="stylesheet" type="text/css" />
    <link href="../script/jBox/Skins/Blue/jbox.css" rel="stylesheet" type="text/css" />
    <link href="../style/ks.css" rel="stylesheet" type="text/css" />
    <script src="../script/jBox/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../script/jBox/jquery.jBox-2.3.min.js" type="text/javascript"></script>
    <script src="../script/jBox/i18n/jquery.jBox-zh-CN.js" type="text/javascript"></script>
    <script src="../script/Common.js" type="text/javascript"></script>
    <script src="../script/Data.js" type="text/javascript"></script>
    <script src="../classschedule/exampel/Timetables.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
    <style>
        #coursesTable {
            padding: 15px 10px;
        }

        .Courses-head {
            background-color: #edffff;
        }

        .Courses-head > div {
            text-align: center;
            font-size: 14px;
            line-height: 28px;
        }

        .left-hand-TextDom, .Courses-head {
            background-color: #f2f6f7;
        }

        .Courses-leftHand {
            background-color: #f2f6f7;
            font-size: 12px;
        }

        .Courses-leftHand .left-hand-index {
            color: #9c9c9c;
            margin-bottom: 4px !important;
        }

        .Courses-leftHand .left-hand-name {
            color: #666;
        }

        .Courses-leftHand p {
            text-align: center;
            font-weight: 900;
        }

        .Courses-head > div {
            border-left: none !important;
        }

        .Courses-leftHand > div {
            padding-top: 5px;
            border-bottom: 1px dashed rgb(219, 219, 219);
        }

        .Courses-leftHand > div:last-child {
            border-bottom: none !important;
        }

        .left-hand-TextDom, .Courses-head {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        }

        .Courses-content > ul {
            border-bottom: 1px dashed rgb(219, 219, 219);
            box-sizing: border-box;
        }

        .Courses-content > ul:last-child {
            border-bottom: none !important;
        }

        .highlight-week {
            color: #02a9f5 !important;
        }

        .Courses-content li {
            text-align: center;
            color: #666666;
            font-size: 14px;
            line-height: 50px;
        }

        .Courses-content li span {
            padding: 6px 2px;
            box-sizing: border-box;
            line-height: 18px;
            border-radius: 4px;
            white-space: normal;
            word-break: break-all;
            cursor: pointer;
        }

        .grid-active {
            z-index: 9999;
        }

        .grid-active span {
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
        }
    </style>

    <script type="text/javascript">





    </script>


</head>
<body>

<div class="banner">
    <div class="bgh">
        <div class="page">
            <div id="logo">
                <a href="../Index.aspx.jsp">
                    <img src="../images/Student/logo.gif" alt="" width="165" height="48" />
                </a>
            </div>
            <div class="topxx"><%=studentlogin.getStudentid()%>学员：<%=studentlogin.getStudentname()%>，欢迎您！
                <a href="../myinfo/Index.aspx.jsp">我的信息</a>
<%--                <a href="../user/studentinfor/SystemMsge.aspx.jsp">通知</a>--%>
                <a href="../user/account/ChangePasswd.aspx.jsp">密码修改</a>
                <a href="../../../student1/login.do?action=NoStudenLogin">安全退出</a>
            </div>
            <div class="blog_nav">
                <ul>
                    <li><a href="../myinfo/Index.aspx.jsp">我的信息</a></li>
                    <li><a href="../educationcenter/Application.aspx.jsp">教务中心</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>


    <div class="page">
        <div class="box mtop">
            <div class="leftbox">
                <div class="l_nav2">
                    <div class="ta1">
                        <strong>个人中心</strong>
                        <div class="leftbgbt">
                        </div>
                    </div>
                    <div class="cdlist">
                        <div>
                            <a href="../myinfo/Index.aspx.jsp">我的信息</a></div>
                        <div>
                            <a href="../myinfo/ClassInfo.aspx.jsp">班级信息 </a>
                        </div>
<%--                        <div>--%>
<%--                            <a href="../user/studentinfor/SystemMsge.aspx.jsp">学院通知</a></div>--%>
                    </div>
                    <div class="ta1">
                        <strong>教务中心</strong>
                        <div class="leftbgbt2">
                        </div>
                    </div>
                    <div class="cdlist">
                        <div>
                            <a href="Application.aspx.jsp">选课</a></div>
                        <div>
                            <a href="Book.aspx.jsp">我的选课</a>
                        </div>
<%--                        <div>--%>
<%--                            <a href="Score.aspx.jsp">我的成绩</a>--%>
<%--                        </div>--%>

                        <div>
                            <a href="Classschedule.jsp">我的课表</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="rightbox">
                
    <h2 class="mbx">
        教务中心 &gt; 我的课表</h2>
    <div class="morebt">
        <ul>
            <li><a class="tab2" href="Application.aspx.jsp">选课</a></li>
            <li><a class="tab2" href="Book.aspx.jsp">我的选课</a></li>
<%--            <li><a class="tab2" href="Score.aspx.jsp">我的成绩</a></li>--%>
            <li><a class="tab1" href="Classschedule.jsp">我的课表</a></li>
        </ul>
    </div>
    <div class="cztable">
<%--        <table width="100%" border="0" cellspacing="0" cellpadding="0">--%>
<%--            <tbody>--%>
<%--                <tr>--%>
<%--                    <th scope="col" style="width: 100px;">&nbsp;--%>
<%--                        时间--%>
<%--                    </th>--%>
<%--                    <th scope="col" style="width: 100px;">&nbsp;--%>
<%--                        周一--%>
<%--                    </th>--%>
<%--                    <th scope="col" valign="top">--%>
<%--                       周二--%>
<%--                    </th>--%>
<%--                    <th scope="col" valign="top">--%>
<%--                        周三--%>
<%--                    </th>--%>
<%--                    <th scope="col" valign="top">--%>
<%--                        周四--%>
<%--                    </th>--%>
<%--                    <th scope="col" valign="top">--%>
<%--                      周五--%>
<%--                    </th>--%>
<%--                    <th scope="col" valign="top">--%>
<%--                        周六--%>
<%--                    </th>--%>
<%--                </tr>--%>

                <div>
                    <label class="mbx">切换课表</label>
                    <select id="pageSizeselect">
                    </select>
                    <div id="coursesTable"></div>
                </div>
<%--            <tbody id="tb">--%>
<%--                          <tr>--%>
<%--                            <td>8-10</td>--%>
<%--                            <td>193027</td>--%>
<%--                            <td>食品安全</td>--%>
<%--                            <td>2.5</td>--%>
<%--                            <td>16周</td>--%>
<%--                            <td>李华</td>--%>
<%--                            <td>--%>
<%--                                <button class="btn btn-danger"data-toggle="modal" data-target="#productModal">退课</button>--%>
<%--                            </td>--%>
<%--                          </tr>--%>
<%--            </tbody>--%>
                
<%--            </tbody>--%>
<%--        </table>--%>

            </div>
        </div>
    </div>
    </div>


<script>




    //



    // function converTime (timeString) {
    //     const time=new Date(timeString);
    //     timeString=time.getFullYear();
    //     return timeString;
    // }


     //定义7第数组，这是数组，全是拿来装学生的周一到周五的课程的
    var course01=[];
    var course02=[];
    var course03=[];
    var course04=[];
    var course05=[];
    var course06=[];
    var course07=[];




    var studentid = "<%=studentlogin.getStudid()%>";

    //下拉选择查询那个年份
    $("#pageSizeselect").change(function () {
        var pagSize=$("#pageSizeselect").val();


        $.ajax({
            type:'POST',
            url:'../../../student1/StudentServlet.do',
            dataType: 'text',
            data:{
                action:'selectdate',
                studentDeta:pagSize,
                studentId:studentid
            },
            success:function (data) {


                var parse = JSON.parse(data);


                for (var i = 0; i<=parse.length ; i++) {
                    if (i==0){
                        course01=parse[0];
                    }

                    if (i==1){
                        course02=parse[1];
                    }

                    if (i==2){
                        course03=parse[2];
                    }

                    if (i==3){
                        course04=parse[3];
                    }

                    if (i==4){
                        course05=parse[4];
                    }

                    if (i==5){
                        course06=parse[5];
                    }

                    if (i==6){
                        course07=parse[6];
                    }
                }

                onChange();
            },
            error:function (data) {
                swal({
                    title : "查询我的选课提示",
                    type : "error",
                    text : "查询我的选课信息失败",
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });
            }

        })
    });



    var s = "<%=studentlogin.getAdmissionDate()%>";

    //查询当前时间
    function selectdate (timeString){
        //计算第一个时间
        const time=new Date(timeString);
        //时间一
        timeString=time.getFullYear();
        //时间二
        timeString01=time.getFullYear()+1;
        //时间三
        timeString02=time.getFullYear()+2;
        //时间四
        timeString03=time.getFullYear()+3;
        timeString04=time.getFullYear()+4;

        var str = ";"

        str += "<option  value="+timeString+"-"+timeString01+"-上学期"+">" + timeString+"-"+timeString01+"-上学期" + "</option>"
            +"<option  value="+timeString+"-"+timeString01+"-下学期"+">" + timeString+"-"+timeString01+"-下学期"+ "</option>"
            +"<option  value="+timeString01+"-"+timeString02+"-上学期"+">" + timeString01+"-"+timeString02 +"-上学期"+"</option>"
            +"<option  value="+timeString01+"-"+timeString02+"-下学期"+">" + timeString01+"-"+timeString02 +"-下学期"+"</option>"
            +"<option  value="+timeString02+"-"+timeString03+"-上学期"+">" + timeString02+"-"+timeString03+"-上学期" + "</option>"
            +"<option  value="+timeString02+"-"+timeString03+"-下学期"+">" + timeString02+"-"+timeString03+"-下学期" + "</option>"
            +"<option  value="+timeString03+"-"+timeString04+"-上学期"+">" + timeString03+"-"+timeString04+"-上学期" + "</option>"
            +"<option  value="+timeString03+"-"+timeString04+"-下学期"+">" + timeString03+"-"+timeString04+"-下学期" + "</option>"
        $("#pageSizeselect").html(str);
      }

    selectdate(s);





    //查询学生个人的选修课的信息
    function lookCourse(){


        $.ajax({
            type:'POST',
            dataType: 'text',
            url:'../../../student1/StudentServlet.do',
            data:{
                action:'selectdate',
                studentDeta:s,
                studentId:studentid
            },
            success:function (data) {




                var parse = JSON.parse(data);


                for (var i = 0; i<=parse.length ; i++) {
                    if (i==0){
                        course01=parse[0];
                    }

                    if (i==1){
                        course02=parse[1];
                    }

                    if (i==2){
                        course03=parse[2];
                    }

                    if (i==3){
                        course04=parse[3];
                    }

                    if (i==4){
                        course05=parse[4];
                    }

                    if (i==5){
                        course06=parse[5];
                    }

                    if (i==6){
                        course07=parse[6];
                    }

                }

            },
            error:function (data) {
                swal({
                    title : "查询我的选课提示",
                    type : "error",
                    text : "查询我的选课信息失败",
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });
            }

        })
    }


    lookCourse();



        var courseList = [
            [course01[0], course01[0], course01[1], course01[1], course01[2], course01[2], course01[3], course01[3], course01[4], course01[4]],
            [course02[0], course02[0], course02[1], course02[1], course02[2], course02[2], course02[3], course02[3], course02[4], course02[4]],
            [course03[0], course03[0], course03[1], course03[1], course03[2], course03[2], course03[3], course03[3], course03[4], course03[4]],
            [course04[0], course04[0], course04[1], course04[1], course04[2], course04[2], course04[3], course04[3], course04[4], course04[4]],
            [course05[0], course05[0], course05[1], course05[1], course05[2], course05[2], course05[3], course05[3], course05[4], course05[4]],
            [course06[0], course06[0], course06[1], course06[1], course06[2], course06[2], course06[3], course06[3], course06[4], course06[4]],
            [course07[0], course07[0], course07[1], course07[1], course07[2], course07[2], course07[3], course07[3], course07[4], course07[4]],
        ];



        var week = window.innerWidth > 360 ? ['周一', '周二', '周三', '周四', '周五', '周六', '周末'] :
            ['一', '二', '三', '四', '五', '六', '七'];
        var day = new Date().getDay();
        var courseType = [
            [{name: '8:00-8:45'}, 1],
            [{name: '8:55-9:40'}, 1],
            [{name: '10:00-10:45'}, 1],
            [{name: '10:55-11:45'}, 1],
            [{name: '14:00-14:45'}, 1],
            [{name: '14:55-15:40'}, 1],
            [{name: '15:50-16:35'}, 1],
            [{name: '16:45-17:25'}, 1],
            [{name: '18:00-18:45'}, 1],
            [{name: '18:55-19:40'}, 1]
        ];


        // 实例化(初始化课表)
       var Timetable = new Timetables({
            el: '#coursesTable',
            timetables: courseList,
            week: week,
            timetableType: courseType,
            highlightWeek: day,
            gridOnClick: function (e) {
                // alert(e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节');
                // console.log(e);

                swal({
                    title : "我的选课退课提示",
                    type : "error",
                    text : e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节',
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });


            },
            styles: {
                Gheight: 50
            }
        });




    function onChange() {

        var courseListOther = [
            [course01[0], course01[0], course01[1], course01[1], course01[2], course01[2], course01[3], course01[3], course01[4], course01[4]],
            [course02[0], course02[0], course02[1], course02[1], course02[2], course02[2], course02[3], course02[3], course02[4], course02[4]],
            [course03[0], course03[0], course03[1], course03[1], course03[2], course03[2], course03[3], course03[3], course03[4], course03[4]],
            [course04[0], course04[0], course04[1], course04[1], course04[2], course04[2], course04[3], course04[3], course04[4], course04[4]],
            [course05[0], course05[0], course05[1], course05[1], course05[2], course05[2], course05[3], course05[3], course05[4], course05[4]],
            [course06[0], course06[0], course06[1], course06[1], course06[2], course06[2], course06[3], course06[3], course06[4], course06[4]],
            [course07[0], course07[0], course07[1], course07[1], course07[2], course07[2], course07[3], course07[3], course07[4], course07[4]],
        ];

        var week = window.innerWidth > 360 ? ['周一', '周二', '周三', '周四', '周五', '周六', '周末'] :
        ['一', '二', '三', '四', '五', '六', '七'];

       Timetable.setOption({
            timetables: courseListOther,
            week: week,
            styles: {
                palette: ['#dedcda', '#ff4081']
            },
            timetableType: courseType,
            gridOnClick: function (e) {
                swal({
                    title : "我的课程表信息",
                    type : "error",
                    text : e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节',
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });
            }
        });

    }



</script>


</body>
</html>
